import React from 'react';
import { Input } from '@teamix/ui';
import { Title } from '@alife/devops-ui';
import './index.scss';

// addonBeforeClassName自定义类名
export default class AddonBeforeInput extends React.PureComponent {
  render() {
    const { addonTextBefore, addonBeforeClassName, ...others } = this.props;
    const title = (
      <Title trigger={<span>{addonTextBefore}</span>} align="t">
        <div>{addonTextBefore}</div>
      </Title>
    );
    return (
      <Input.Group
        addonBefore={title}
        addonBeforeClassName={`one-line-ellipsis input-group-addon-before yx-input-group-text yx-medium ${addonBeforeClassName}`}
        className="customize-input-group"
      >
        <Input {...others} />
      </Input.Group>
    );
  }
}
